package com.yst.webplugin.permission;

import org.springframework.core.annotation.AliasFor;

import java.lang.annotation.*;

/**
 * Annotation for role
 */
@Target({ElementType.ANNOTATION_TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Role {
    /**
     * name of role
     */
    String name() default "";

    @AliasFor("name")
    String value() default "";

    /**
     * description of role
     */
    String description() default "";
    /**
     * role group
     */
    @Target({ElementType.FIELD,ElementType.TYPE,ElementType.METHOD})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface Roles{
        /**
         * link type
         */
        GroupType type() default GroupType.AND;

        /**
         * array of role data
         */
        Role[] value() default {};
    }
}
